package com.alibaba.nacos.config.server.jpa.repository;

import java.time.LocalDateTime;
import java.util.List;

import com.alibaba.nacos.config.server.jpa.entity.HisConfigInfoEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;

/**
 * @author
 * @date 2020-03-08 23:31
 */
@Repository
public interface HisConfigInfoRepository extends BaseRepository<HisConfigInfoEntity, Long> {

    HisConfigInfoEntity findByNid(Long nid);

    int countByGmtModifiedLessThan(LocalDateTime startTime);

    List<HisConfigInfoEntity> findByGmtModifiedBetween(LocalDateTime startTime, LocalDateTime endTime);

    Page<HisConfigInfoEntity> findByGmtModifiedBefore(LocalDateTime gmtModified, Pageable pageable);

    @Modifying
    void deleteByIdIn(List<Long> ids);
}
